package atm;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class SearchPanel extends JPanel implements ActionListener {
    private ATMFrame atmFrame;
    private ImageIcon sure = new ImageIcon("images/buttonSure.jpg");
    private JLabel money = new JLabel("账户金额：");
    private JTextField moneyField = new JTextField();
    private JButton sure1=new JButton(sure);
    private Font font = new Font("黑体",Font.BOLD,20);

    public  SearchPanel(ATMFrame atmFrame){
        this.atmFrame=atmFrame;
        this.setLayout(null);
        this.add(sure1);
        this.add(money);
        this.add(moneyField);
        money.setBounds(300,200,120,50);
        sure1.setBounds(400,360,140,50);
        moneyField.setBounds(400,200,140,50);
        money.setFont(font);
        sure1.addActionListener(this);
       // moneyField.setText("00000");



        this.setOpaque(false);
    }

    public void showBlance(){
        moneyField.setText( atmFrame.getLoginUser().getBlance()+"");
    }
    @Override
    public void actionPerformed(ActionEvent e) {
        System.out.println("查询点击"+e.getActionCommand());
        if( e.getSource() == sure1){
           // showBlance();
            System.out.println(moneyField.getText());
           // moneyField.getText();

            atmFrame.switchPanel("menu");
        }
    }
}
